package tests;

import generation.Generator;
import models.Track;

import org.jfugue.Pattern;
import org.junit.Test;

import junit.framework.TestCase;

public class GeneratorTest extends TestCase {
	
	@Test
	public void testGenerateReturn() 
	{
		Track testTrack = new Track("TestTitle", new String[] {"Piano", "Trumpet", "Oboe", "Violin"}, 4, 2, false, "C Major", 120);
		Generator tester = new Generator();
		Pattern p = tester.generateNewTrack(testTrack);
		assertNotNull(p);
	}
	

	@Test
	public void testRandom() 
	{
		Track testTrack = new Track("TestTitle", new String[] {"Piano", "Trumpet", "Oboe", "Violin"}, 4, 2, false, "C Major", 120);
		Track testTrack2 = new Track("TestTitle2", new String[] {"Piano", "Trumpet", "Oboe", "Violin"}, 4, 2, false, "C Major", 120);
		Generator tester = new Generator();
		Pattern p = tester.generateNewTrack(testTrack);
		Pattern p2 = tester.generateNewTrack(testTrack2);
		assertEquals(false, p.equals(p2));
	}
	
	@Test
	public void testValidMockOutput() 
	{
		Track testTrack = new Track("TestTitle", new String[] {"Piano", "Trumpet", "Oboe", "Violin"}, 4, 2, false, "C Major", 120);
		Track testTrack2 = new Track("TestTitle2", new String[] {"Piano", "Trumpet", "Oboe", "Violin"}, 4, 2, false, "C Major", 120);
		MockGenerator tester = new MockGenerator();
		Pattern p = tester.generateNewTrack(testTrack);
		Pattern p2 = tester.generateNewTrack(testTrack2);
		assertEquals(true, p.toString().equals(p2.toString()));
	}
	
	@Test
	public void testHarmonicsValues()
	{
		Track testTrack = new Track("TestTitle", new String[] {"Piano", "Trumpet", "Oboe", "Violin"}, 4, 2, false, "C Major", 120);
		Track testTrack2 = new Track("TestTitle2", new String[] {"Piano", "Trumpet", "Oboe", "Violin"}, 4, 2, true, "C Major", 120);
		MockGenerator tester = new MockGenerator();
		Pattern p = tester.generateNewTrack(testTrack);
		Pattern p2 = tester.generateNewTrack(testTrack2);
		System.out.println(p);
		System.out.println(p2);
		assertEquals(false, p.toString().equals(p2.toString()));
	}
}
